#!/usr/bin/make -f

DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

ifneq (,$(findstring alpha,$(DEB_BUILD_GNU_TYPE)))
	CFLAGS += -mieee
	CXXFLAGS += -mieee
endif

%:
	dh $@

.PHONY: clean
clean:
	dh clean
	rm -rf libltdl

.PHONY: override_dh_auto_configure
override_dh_auto_configure:
	libtoolize --install #--copy
	[ -e config.h.in ] || touch config.h.in
	aclocal
	autoheader
	automake --add-missing
	autoconf
	dh_auto_configure -- --bindir=/usr/games --datadir=/usr/share/games --with-cflags="$(CFLAGS)" --with-cxxflags="$(CXXFLAGS)"

.PHONY: override_dh_install
override_dh_install:
	install -d $(CURDIR)/debian/tmp/usr/share/applications
	install -d $(CURDIR)/debian/tmp/usr/share/pixmaps
	install -m 644 pinball.desktop $(CURDIR)/debian/tmp/usr/share/applications
	install -m 644 data/pinball.xpm $(CURDIR)/debian/tmp/usr/share/pixmaps
	nsgmls debian/pinball.sgml | sgmlspl sgmlspl-specs/docbook2man-spec.pl
	dh_install

.PHONY: override_dh_fixperms
override_dh_fixperms:
	dh_fixperms
	chown root:games debian/pinball/usr/games/pinball
	chmod 2755 debian/pinball/usr/games/pinball

.PHONY: override_dh_makeshlibs
override_dh_makeshlibs:
